import requests

uploadurl = ''

saveurl = ''


headers = {
    'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/129.0.0.0 Safari/537.36',
    'Cookie':'JSESSIONID=a0a5f464-fe49-4898-8cfd-e95bbb71b89e; James_cookie_sYQDUGqqzHtheme=custom; webfinal.session.errorCount=0'
}

response = None
with open(r'D:\Desktop\exceltest\530100.xls','rb') as xls:
    param = {}
    files = {}
    param['url'] = ''
    param['filepath1'] = ''
    param['filename'] = '530100.xls'
    param['parent_name'] = '直属机关'
    param['parent_code'] = '240909041201'
    param['region_name'] = '昆明市'
    param['region_code'] = '530100'
    param['organ_level'] = '3'
    param['parent_type'] = 'region'
    param['type'] = '0'
    param['path_parent_code'] = ''
    files['file'] = xls

    response = requests.post(url=uploadurl, headers=headers, data=param, files=files)
    print(response.text)
    if response.status_code == 200 and response.json()['statusCode'] == 200:
        param['filepath1'] = response.json()['filePath']
        response = requests.post(url=saveurl, headers=headers, data=param)
        print(response.text)




